package wire

import (
	"github.com/garyburd/redigo/redis"
	"github.com/xormplus/xorm"

	"gitee.com/krio/grpc-go-server/cmd/lib"
	"gitee.com/krio/grpc-go-server/cmd/script/handler"
	"gitee.com/krio/helper/logger"
)

type FillerApp struct {
	Config           *lib.Config
	Logger           *logger.Logger
	Redis            *redis.Pool
	Dao              *xorm.Engine
	UserCmdHandler   *handler.UserCmdHandler
	RegionCmdHandler *handler.RegionCmdHandler
}

func (a *FillerApp) FillerRun() error {
	if err := a.UserCmdHandler.AddFillUser(1); err != nil {
		return err
	}

	// if err := a.RegionCmdHandler.AddFillData("./dao/sql/AMap_20210406.xlsx"); err != nil {
	// 	return nil
	// }

	return nil
}

func FillerInitLogger() *logger.Logger {
	return lib.InitLog(&lib.Log{
		Level:    "debug",
		FilePath: lib.C.Logger.FilePath + "/cmd/filler",
		Debug:    true,
	})
}
